from typing import List


class Solution:
    def exchange(self, nums: List[int]) -> List[int]:
        left = 0
        right = len(nums)-1
        while (left<right):
            if left< right and nums[left] %2 ==1:
                left+=1
            
            if left < right and nums[right] %2 ==0:
                right -= 1
            
            if left< right:
                temp = nums[left]
                nums[left] = nums[right]
                nums[right] = temp
        return nums
